package ift605.tp3.utils;

public class Token
{
    String m_string;
    
    public Token(String p_string)
    {
        m_string = p_string;
    }
    
    public Character getToken()
    {
        if (length() == 0)
        {
            return null;
        }
        
        return m_string.charAt(0);
    }
    
    public Character getNextToken()
    {
        if (nextToken())
        {
            return getToken();
        }
        return null;
    }
    
    public int length()
    {
        return m_string.length();
    }
    
    public boolean nextToken()
    {
        if (m_string.length() > 1)
        {
            m_string = m_string.substring(1);
        }
        else
        {
            m_string = "";
        }
        
        return length() != 0;
    }
}
